package com.suneee.base.processor;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import com.suneee.core.error.ErrorUtils;

@StaticResource(key="static.resource",value="静态属性资源")
public class StaticResourceProvider {
	
	private Properties props ;
	
	private void load(){
		if(props!=null){
			return ;
		}
		InputStream input =null;
		try{
			input= this.getClass().getClassLoader().getResourceAsStream("staticResource.properties");
			props=new Properties();
			props.load(input);
		}catch(Exception e){
			props=null;
			throw ErrorUtils.wrap( e);
		}finally{
			if(input!=null){
				try {
					input.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}
		
	}

	public Properties getProps() {
		load();
		return props;
	}

	
}
